package com.clkj.nangang.mvp.base;

import android.app.ProgressDialog;
import android.support.v4.app.Fragment;
import android.view.View;


/**
 * Created by Administrator on 2017/6/20.
 */

public abstract class BaseFragment extends Fragment {

    public abstract void initData();

    public abstract void assignView(View view);

    public abstract void initView();


/*    LoadingProgressDialog progressDialog;

    public void showProgressDialog(boolean canBack, String loadingMsg) {
        if (progressDialog != null) {
            progressDialog.cancel();
        }

        progressDialog = new LoadingProgressDialog(getActivity(), loadingMsg);
        if (canBack) {
            progressDialog.setCancelable(true);
        } else {
            progressDialog.setCancelable(false);
        }
        progressDialog.show();
    }

    public void dismissProgressDialog() {
        if (null != progressDialog && progressDialog.isShowing()) {
            progressDialog.cancel();
        }
    }*/

    private ProgressDialog progDialog;

    public void showLoading() {
        if (progDialog == null) {
            progDialog = new ProgressDialog(getActivity());
            progDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
            progDialog.setIndeterminate(false);
            progDialog.setCancelable(true);
            progDialog.setMessage("正在加载...");
            progDialog.show();
        }
    }

    public void dismissLoading() {
        if (progDialog != null) {
            progDialog.dismiss();
        }
    }
}
